package com.hundsun.fcp.dialog;


import android.app.Dialog;
import android.content.Context;
import android.view.View;
import android.view.WindowManager;
import android.view.WindowManager.LayoutParams;
import android.widget.Button;
import android.widget.Toast;

import com.hundsun.fcp.R;
import com.hundsun.fcp.common.logger.AndroidLogger;
import com.hundsun.fcp.common.logger.Logger;
import com.hundsun.fcp.widget.gridpwd.GridPasswordView;

public class TransPwdDialog extends Dialog {
	
	Logger logger = AndroidLogger.getLogger();
	
	private Context mContext; 
	/**确定*/
	private Button mConfirmBtn ;
	/**取消*/
	private Button mCancelBtn ; 
	
	private GridPasswordView mInputLayout ;
	
	
	public TransPwdDialog(Context context) {
		super(context, R.style.CustomStyle);
		setContentView(R.layout.dialog_transpwd_box) ;
		mContext = context;
		init(); 
	}

	private void init() {
		initView();
		initListener();
	}

	private void initListener() {
		mConfirmBtn.setOnClickListener(btnOnClickListener) ;
		mCancelBtn.setOnClickListener(btnOnClickListener) ;
	}

	private void initView() {
		mConfirmBtn = (Button) findViewById(R.id.btn_confirm) ;
		mCancelBtn = (Button) findViewById(R.id.btn_cancel) ;
		mInputLayout = (GridPasswordView) findViewById(R.id.gpv_transpwd) ;
	}
	
	private android.view.View.OnClickListener btnOnClickListener = new android.view.View.OnClickListener() {
		
		@Override
		public void onClick(View v) {
			if(v == mConfirmBtn){
				Toast.makeText(mContext, mInputLayout.getPassWord(), 0).show() ;
			}else if(v==mCancelBtn){
				
			}
			
			dismiss() ;
		}
	};
	
	
	@Override
	public void show() {
	    WindowManager.LayoutParams params = getWindow().getAttributes();  
	    params.width = LayoutParams.MATCH_PARENT;  
	    params.height = LayoutParams.WRAP_CONTENT;  
	    getWindow().setAttributes(params);  
		super.show();
	};
	

}
